package io.github.wanggit.antrpc.client.zk.lb;

import io.github.wanggit.antrpc.client.zk.zknode.NodeHostEntity;
import io.github.wanggit.antrpc.commons.bean.Host;
import io.github.wanggit.antrpc.commons.bean.RegisterBeanMethod;

import java.util.List;
import java.util.Map;

public interface ILoadBalancer {

    NodeHostEntity choose();

    boolean isEmpty();

    void setWeights(Map<String, Integer> weights);

    void addHost(NodeHostEntity host);

    void updateHost(NodeHostEntity host);

    void deleteHost(NodeHostEntity host);

    List<NodeHostEntity> getAllNodeHostEntities();

    /**
     * 更新服务消费端的限流信息
     *
     * @param host host
     * @param registerBeanMethod register bean method
     */
    void updateHostRateLimit(Host host, RegisterBeanMethod registerBeanMethod);
}
